package br.ufc.ck0017.ir.translate;

import br.ufc.ck0017.ir.tree.IR;
import br.ufc.ck0017.ir.tree.IRNode;
import br.ufc.ck0017.temp.Label;
import br.ufc.ck0017.ir.tree.CJUMP.LogicalOperator;

public class TranslateEx extends TranslatedExpression {
    private IRNode node;

    public TranslateEx(IRNode node) {
        this.node = node;
    }

    @Override
    public IRNode unEx() {
        return node;
    }

    @Override
    public IRNode unNx() {
        return IR.EXP(node);
    }

    @Override
    public IRNode unCx(Label trueLabel, Label falseLabel) {
        return IR.CJUMP(LogicalOperator.EQ, unEx(), IR.TRUE, trueLabel, falseLabel);
    }
}
